//
// Created by 86138 on 2025/5/15.
//

#ifndef QINGDAO_UNIVERSITY_SQSTACK_H
#define QINGDAO_UNIVERSITY_SQSTACK_H
#include "../01-intro/c1-1.h"

#define STACK_INIT_SIZE 5
#define STACKINCREMENT 5

typedef int SElemType;

typedef struct SqStack{
    SElemType *top; // 也可以用int标记top，但是这里选择用了指针，因为两个指针之间的减法也能work
    SElemType *base;
    int stacksize; // 当前可使用的**最大**容量
} SeqStack;

void InitStack(SqStack &S);

void DestroyStack(SqStack &S);

void ClearStack(SqStack &S);

Boolean StackEmpty(SqStack &S);

int StackLength(SqStack &S);

Status GetTop(SqStack S, SElemType &e);

Status Push(SqStack &S, SElemType &e);

Status Pop(SqStack &S, SElemType &e);

void StackTraverse(SqStack S, void(*visit) (SElemType));

Status Resize(SqStack &S);
#endif //QINGDAO_UNIVERSITY_SQSTACK_H
